package gui;

import java.awt.Component;
import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class QueryRegionPanel extends JPanel {
  private static final long serialVersionUID = 1519994997213620493L;

  private JTextField txtLatWest = new JTextField();
  private JTextField txtLatEast = new JTextField();
  private JTextField txtLongWest = new JTextField();
  private JTextField txtLongEast = new JTextField();
  
  public QueryRegionPanel() {
    super();
    
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    setBorder(BorderFactory.createTitledBorder("Region Settings"));
    setAlignmentX(Component.LEFT_ALIGNMENT);
    
    Dimension dim = new Dimension(290,90);
    setPreferredSize(dim);
    setMaximumSize(dim);
    
    add(getLatitudeInputs());
    add(Box.createVerticalStrut(10));
    add(getLongitudeInputs());
  }
  
  private JPanel getLatitudeInputs() {
    JPanel pnl = new JPanel();
    pnl.setLayout(new BoxLayout(pnl, BoxLayout.LINE_AXIS));
    pnl.setAlignmentX(Component.LEFT_ALIGNMENT);
    pnl.add(new JLabel("West Latitude: "));
    pnl.add(txtLatWest);
    pnl.add(new JLabel("East Latitude: "));
    pnl.add(txtLatEast);
    return pnl;
  }
  
  private JPanel getLongitudeInputs() {
    JPanel pnl = new JPanel();
    pnl.setLayout(new BoxLayout(pnl, BoxLayout.LINE_AXIS));
    pnl.setAlignmentX(Component.LEFT_ALIGNMENT);
    pnl.add(new JLabel("West Longitude: "));
    pnl.add(txtLongWest);
    pnl.add(new JLabel("East Longitude: "));
    pnl.add(txtLongEast);
    return pnl;
  }
}
